#include <sys_head.h>

int main(int argc, char const *argv[])
{
    key_t key = ftok("/home/student/桌面",2);
    int id = semget(key,2,0666);
    // int val = 1;
    // semctl(id,0,SETVAL,val);
    while (1)
    {
        struct sembuf sb;
        sb.sem_num = 1;
        sb.sem_op = -1;
        sb.sem_flg = 0;
        semop(id,&sb,1);
        printf("222222\n");
        sb.sem_num = 0;
        sb.sem_op = 1;
        semop(id,&sb,1);
    }
    return 0;
}
